#include <stdio.h>
#include <stdint.h>
#include "src/include/dynamic_range_compression.h"
#include "src/drc_core.h"
#include "audio_drc.h"
#ifdef DMALLOC
#include <imp/dmalloc.h>
#endif
DrcHandle* audio_process_drc_create()
{
	DrcHandle* handle_drc;
	handle_drc = Drc_Create();

	return handle_drc;
}

int audio_process_drc_set_config(DrcHandle *handle,int samplerate, int threshold1, float ratio, int threshold2, int mode, float supPoint, float supExp)
{
	if(NULL == handle)
		return -1;
	int nRet = 0;
	nRet = Drc_Init(handle, samplerate, threshold1, ratio, threshold2, mode, supPoint, supExp);	
	if(nRet != 0)
		return -1;

	return 0;
}

void audio_process_drc_process(DrcHandle* handle,const float* const* spframe, float* const* outframe)
{
	if(NULL == handle||NULL == spframe||NULL == *spframe
	||NULL == outframe||NULL == *outframe)
		return;
	Drc_Process(handle, spframe, outframe);
}

void audio_process_drc_free(DrcHandle* handle)
{
	Drc_Free(handle);
}

